const express = require('express');
const router = express.Router();
const reservationController = require('../controllers/reservationController');
const { authenticate } = require('../middleware/authMiddleware');

// 添加路由日志中间件
router.use((req, res, next) => {
  next();
});

// 创建预订
router.post('/create', authenticate, reservationController.createReservation);

// 获取用户预订列表
router.get('/list', authenticate, reservationController.getUserReservations);

// 获取预订详情
router.get('/detail/:id', authenticate, reservationController.getReservationDetail);

// 取消预订
router.post('/cancel/:id', authenticate, reservationController.cancelReservation);

//获取房间的已预约时间
router.get('/reverseTime/:id', reservationController.getReservedTimes);
module.exports = router; 